package com.example.repository;

import java.util.HashMap;
import java.util.Map;

// 注意：这里没有使用@Repository注解
public class UserRepository {
    private Map<Integer, Map<String, String>> users = new HashMap<>();
    private int idCounter = 1;
    
    public int saveUser(String username, String email) {
        Map<String, String> userData = new HashMap<>();
        userData.put("username", username);
        userData.put("email", email);
        
        int userId = idCounter++;
        users.put(userId, userData);
        return userId;
    }
    
    public String getUserInfo(int userId) {
        Map<String, String> userData = users.get(userId);
        if (userData != null) {
            return "用户ID: " + userId + 
                   ", 用户名: " + userData.get("username") + 
                   ", 邮箱: " + userData.get("email");
        }
        return "用户不存在，ID: " + userId;
    }
    
    public int getUserCount() {
        return users.size();
    }
}